package com.longfor.dragonshard.dto;

//import com.longfor.dragonshard.dto.catalog.CatalogAddDTO;
//import com.longfor.dragonshard.dto.catalog.CatalogTreeDTO;
//import com.longfor.dragonshard.dto.catalog.CatalogUpdateDTO;
import com.longfor.dragonshard.dto.demo.DemoAddDTO;
import com.longfor.dragonshard.dto.demo.DemoSearchListDTO;
import com.longfor.dragonshard.dto.demo.DemoUpdateDTO;
//import com.longfor.dragonshard.entity.Catalog;
import com.longfor.dragonshard.entity.Demo;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * DTO 与 Entity转换接口
 *
 * 注解参数：
 * 字段名不同时进行转换， target是DTO字段，source是Entity字段
 * @Mapping(target = "personName", source = "name")
 *
 * DTO中存在Entity中没有的字段
 * @Mapping(target = "hand",  ignore = true)
 *
 * @author chi.zhang
 * @version v1.0
 * @create 2017-11-13 下午5:53
 **/
@Mapper(componentModel = "spring")
public interface ConvertMapper {
    ConvertMapper INSTANCE = Mappers.getMapper(ConvertMapper.class);

    /**
     * ---------------------------
     * Demo
     * ---------------------------
     */
    DemoAddDTO entityToDTO(Demo entity);
    void updateEntityFromDTO(DemoAddDTO demoAddDTO, @MappingTarget Demo entity);
    void updateEntityFromDTO(List<DemoAddDTO> demoAddDTOList, @MappingTarget List<Demo> entity);
    void updateEntityFromDTO(DemoUpdateDTO demoUpdateDTO, @MappingTarget Demo entity);
    void updateEntityFromDTO(DemoSearchListDTO demoSearchListDTO, @MappingTarget Demo entity);

    /**
     * Catalog 目录模块 AddDTO与Entity转换
     * @param catalogAddDTO
     * @param entity
     */
    //void updateEntityFromDTO(CatalogAddDTO catalogAddDTO, @MappingTarget Catalog entity);

    /**
     * Catalog 目录模块 UpdateDTO与Entity转换
     * @param catalogUpdateDTO
     * @param entity
     */
    //void updateEntityFromDTO(CatalogUpdateDTO catalogUpdateDTO, @MappingTarget Catalog entity);

    /**
     * Catalog 目录模块 TreeDTO与Entity转换
     * @param catalogTreeDTO
     * @param entity
     */
    //void updateEntityFromDTO(@MappingTarget CatalogTreeDTO catalogTreeDTO,  Catalog entity);

}
